<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- width 设置布局视口的宽度 -->
    <!-- <meta name="viewport" content="width=600"> -->
    <!-- <meta name="viewport" content="width=device-width"> -->

    <!-- initial-scale 初始化的比例 设置布局视口的 -->
    <!-- <meta name="viewport" content="initial-scale=1"> -->
    <!-- <meta name="viewport" content="width=600, initial-scale=0.5"> -->

    <!-- minimum-scale 最小的比例 -->
    <!-- <meta name="viewport" content="minimum-scale=1"> -->
    <!-- <meta name="viewport" content="maximum-scale=1"> -->
    <!-- <meta name="viewport" content="maximum-scale=1, minimum-scale=1"> -->
    <!-- <meta name="viewport" content="user-scalable=no"> -->

    <title>Document</title>
    <style>
        #box{
            width: 200px;
            height: 100px;
            border:solid 1px #ddd;
        }
    </style>
</head>
<body>
    <div id="box"></div>

    <script>
        // console.log(document.documentElement.clientWidth);

        //设置 box 的文本内容
        setInterval(() => {
            box.innerHTML = '当前的视觉视口为: ' + window.visualViewport.width;
        }, 200);
    </script>
</body>
</html>

